/* 
 * File:   Vertex.cpp
 * Author: RaF
 * 
 * Created on 22 novembre 2012, 11.30
 */

#ifndef VERTEX_H
#define	VERTEX_H
#include <list>
template <typename I> class Edge;

template <typename I> class Vertex {
public:
    Vertex(int label, I info );
    Vertex(const Vertex<I>& orig);
    virtual ~Vertex();
    std::list<Edge<I>*>* getAdjacencyList(){return adjList;}
    int getLabel();
    I getInfo();
private:
    int label;
    I info;
    std::list<Edge<I>*>* adjList;
};


template <typename I> Vertex<I>::Vertex(int label, I info) {
    this->label = label;
    this->info = info;
    this->adjList=new std::list<Edge<I>*>();
}

template <typename I> Vertex<I>::Vertex(const Vertex<I>& orig) {
    this->label = orig.label;
    this->info = orig.info;
}

template <typename I> Vertex<I>::~Vertex() {
    typename std::list<Edge<I>*>::iterator it;
    for(it=this->adjList->begin();it!=this->adjList->end();++it){
        delete (*it);
    }
    delete this->adjList;
    
}

template <typename I> int Vertex<I>::getLabel() {
    return this->label;
}

template <typename I> I Vertex<I>::getInfo() {
    return this->info;
}



#endif